<form class = "layui-form ajax _form" action="{:url('')}" method="post" id = "add_goods">
    <input type="hidden" name="id" value="{$good.id}"/>
    <div class = "layui-form-item">
        <label class = "layui-form-label require">商品名称</label>
        <div class = "layui-input-block">
            <input type="text" name="name" value="{$good.name}" placeholder="请输入商品名称" class="layui-input"required lay-verify="required" />
        </div>
    </div>
    <div class = "layui-form-item">
        <label class = "layui-form-label require">关键字</label>
        <div class = "layui-input-block">
            <div class = "keyword layui-input" name="keyword" value = "{$good.keyword}"></div>
        </div>
    </div>
    <div class = "layui-row">
        <div class = "layui-col-xs6">
            <div class = "layui-form-item">
                <label class = "layui-form-label require">成本价</label>
                <div class = "layui-input-block">
                    <input type="money" placeholder="请输入成本价" class="layui-input" name="origcost" value = "{$good.origcost}" required lay-verify="required"/>
                </div>
            </div>
        </div>
        <div class = "layui-col-xs6">
            <div class = "layui-form-item">
                <label class = "layui-form-label require">售价</label>
                <div class = "layui-input-block">
                    <input type="money" placeholder="请输入售价" class="layui-input" name="price" value="{$good.price}" required lay-verify="required"/>
                </div>
            </div>
        </div>
    </div>

    <div class = "layui-form-item">
        <label class = "layui-form-label require">快递规则</label>
        <div class = "layui-input-block">
            <select name="express_id" required lay-verify="required">
                <option value="">请选择快递规则</option>
                {:archive_option('Express','name','id',$good['express_id'],$mer_id)}
            </select>
        </div>
    </div>
    <div class = "layui-form-item">
        <label class = "layui-form-label">库存</label>
        <div class = "layui-input-block">
            <input type="number" placeholder="请输入库存" class="layui-input" name="stock" value = "{$good.stock}"/>
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">立即上架</label>
        <div class="layui-input-block">
            <input type="checkbox" name="state" value="1" {if condition="$good.state eq 1"}checked{/if} lay-skin="switch">
        </div>
    </div>
    <div class = "layui-form-item">
        <div name="images" id = "images" value = "{$good.images}"></div>
    </div>
    <div class="layui-collapse">
        <div class="layui-colla-item">
            <h2 class="layui-colla-title">基本属性</h2>
            <div class="layui-colla-content">
                <div class = "layui-form-item">
                    <label class = "layui-form-label">品牌</label>
                    <div class = "layui-input-block">
                        <select name = "company">
                            <option value = ''>请选择品牌</option>
                            {:archive_option('Company','name','id',$good['company'],$mer_id)}
                        </select>
                    </div>
                </div>
                <div class = "layui-form-item">
                    <label class = "layui-form-label">季节</label>
                    <div class = "layui-input-block">
                        <select name = "season">
                            <option value = ''>请选择季节</option>
                            {:archive_option('Season','name','id',$good['season'],$mer_id)}
                        </select>
                    </div>
                </div>
                <div class = "layui-form-item">
                    <label class = "layui-form-label">货号</label>
                    <div class = "layui-input-block">
                        <input type="text" name="code" value = "{$good.code}" class = "layui-input"/>
                    </div>
                </div>
                <div class = "layui-form-item">
                    <label class = "layui-form-label">材质</label>
                    <div class = "layui-input-block">
                        <input type="text" name="material" value="{$good.material}" class = "layui-input"/>
                    </div>
                </div>
                <div class = "layui-form-item">
                    <label class="layui-form-label">款式</label>
                    <div class = "layui-input-block">
                        <input type="text" name="style" value = "{$good.style}" class = "layui-input"/>
                    </div>
                </div>
                <div class = "layui-form-item">
                    <label class = "layui-form-label">适用场景</label>
                    <div class = "layui-input-block">
                        {:archive_checkbox("Scene", "name", "id", $good['scene'],$mer_id,"scene")}
                    </div>
                </div>
                <div class = "layui-form-item">
                    <label class = "layui-form-label">适用对象</label>
                    {:archive_checkbox("Intent", "name", "id", $good['intended'],$mer_id,"intended")}
                </div>
            </div>
        </div>
        <div class="layui-colla-item">
            <h2 class="layui-colla-title">尺码规格</h2>
            <div class="layui-colla-content">
                <table class = "layui-table">
                    <thead>
                    <tr>
                        <th>规格</th>
                        <th>价格</th>
                        <th><i class = "layui-icon layui-icon-add-1" onclick="newTr()"></i></th>
                    </tr>
                    </thead>
                    <tbody id = "specs">
                    {volist name="good['goods_spec']" id="vo"}
                    <tr>
                        <td><input type="text" class = "table-input" name = "spec_name[]" value="{$vo.name}"/></td>
                        <td><input type="money" class = "table-input" name = "spec_price[]" value = "{$vo.price}"/></td>
                        <td><i class = "layui-icon layui-icon-close" onclick = "del(this)"></i></td>
                    </tr>
                    {/volist}
                    </tbody>
                </table>
            </div>
        </div>
        <div class="layui-colla-item">
            <h2 class="layui-colla-title">颜色</h2>
            <div class="layui-colla-content">
                <table class = "layui-table">
                    <thead>
                    <tr>
                        <th>颜色</th>
                        <th>图片</th>
                        <th>价格</th>
                        <th><i class = "layui-icon layui-icon-add-1" onclick="newColor()"></i></th>
                    </tr>
                    </thead>
                    <tbody id = "colors">
                        {volist name="good['goods_color']" id="vo"}
                        <tr>
                        <td><input type="text" class = "table-input" name = "color_name[]" value = "{$vo.color}"/></td>
                        <td><div name="color_img[]" value="{$vo.photo}"></div></td>
                        <td><input type="money" class = "table-input" name = "color_price[]" value="{$vo.price}"/></td>
                        <td><i class = "layui-icon layui-icon-close" onclick = "del(this)"></i></td>
                        </tr>
                        {/volist}
                    </tbody>
                </table>
            </div>
        </div>
    </div>
    <div class = "options clearfix">
        <button class = "layui-btn layui-btn-success vm-4 fr" type="submit">提交</button>
    </div>
</form>
